import { createApp } from 'vue'
import 'ant-design-vue/dist/reset.css';
import 'element-plus/dist/index.css'
import router from './router/index.js'
import Viewer from 'v-viewer'
import 'viewerjs/dist/viewer.css'
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
import directive from './directive/index.js'
dayjs.locale('zh-cn')
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import store from './store/index.js'
import App from './App.vue'
import SSO from '@/cas/sso.js'
const app = createApp(App)


async function run () {
    try {
        await SSO.init()
        app.config.globalProperties.$icons = []
        for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
            app.config.globalProperties.$icons.push(key)
            app.component(key, component)
        }
        directive(app)
        app.use(router)
        app.use(store)
        app.use(Viewer, {
            Options: {
                'inline': true,
                'button': true, //右上角按钮
                "navbar": true, //底部缩略图
                "title": true, //当前图片标题
                "toolbar": true, //底部工具栏
                "tooltip": true, //显示缩放百分比
                "movable": true, //是否可以移动
                "zoomable": true, //是否可以缩放
                "rotatable": true, //是否可旋转
                "scalable": true, //是否可翻转
                "transition": true, //使用 CSS3 过度
                "fullscreen": true, //播放时是否全屏
                "keyboard": true, //是否支持键盘
                "url": "data-source",
            }
        })
        await router.isReady()
        app.mount('#app')
    } catch (error) {
        console.log('error', error)
    }
}
run()

